/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */

package com.entities;

import java.io.Serializable;
import java.util.Collection;
import javax.persistence.Basic;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.OneToMany;
import javax.persistence.Table;
import javax.xml.bind.annotation.XmlRootElement;
import javax.xml.bind.annotation.XmlTransient;

/**
 *
 * @author Ondrej
 */
@Entity
@Table(name = "personnel_management")
@XmlRootElement
@NamedQueries({
    @NamedQuery(name = "PersonnelManagement.findAll", query = "SELECT p FROM PersonnelManagement p"),
    @NamedQuery(name = "PersonnelManagement.findById", query = "SELECT p FROM PersonnelManagement p WHERE p.id = :id"),
    @NamedQuery(name = "PersonnelManagement.findByFromDate", query = "SELECT p FROM PersonnelManagement p WHERE p.fromDate = :fromDate"),
    @NamedQuery(name = "PersonnelManagement.findByToDate", query = "SELECT p FROM PersonnelManagement p WHERE p.toDate = :toDate"),
    @NamedQuery(name = "PersonnelManagement.findByApproved", query = "SELECT p FROM PersonnelManagement p WHERE p.approved = :approved")})
public class PersonnelManagement implements Serializable {
    private static final long serialVersionUID = 1L;
    @Id
    @GeneratedValue(strategy = GenerationType.IDENTITY)
    @Basic(optional = false)
    @Column(name = "id")
    private Integer id;
    @Column(name = "from_date")
    private Integer fromDate;
    @Column(name = "to_date")
    private Integer toDate;
    @Column(name = "approved")
    private Character approved;
    @JoinColumn(name = "EMPLOYEE_id", referencedColumnName = "id")
    @ManyToOne
    private Employee eMPLOYEEid;
    @OneToMany(mappedBy = "pERSONNELMANAGEMENTid")
    private Collection<PersonnelManCategory> personnelManCategoryCollection;

    public PersonnelManagement() {
    }

    public PersonnelManagement(Integer id) {
        this.id = id;
    }

    public Integer getId() {
        return id;
    }

    public void setId(Integer id) {
        this.id = id;
    }

    public Integer getFromDate() {
        return fromDate;
    }

    public void setFromDate(Integer fromDate) {
        this.fromDate = fromDate;
    }

    public Integer getToDate() {
        return toDate;
    }

    public void setToDate(Integer toDate) {
        this.toDate = toDate;
    }

    public Character getApproved() {
        return approved;
    }

    public void setApproved(Character approved) {
        this.approved = approved;
    }

    public Employee getEMPLOYEEid() {
        return eMPLOYEEid;
    }

    public void setEMPLOYEEid(Employee eMPLOYEEid) {
        this.eMPLOYEEid = eMPLOYEEid;
    }

    @XmlTransient
    public Collection<PersonnelManCategory> getPersonnelManCategoryCollection() {
        return personnelManCategoryCollection;
    }

    public void setPersonnelManCategoryCollection(Collection<PersonnelManCategory> personnelManCategoryCollection) {
        this.personnelManCategoryCollection = personnelManCategoryCollection;
    }

    @Override
    public int hashCode() {
        int hash = 0;
        hash += (id != null ? id.hashCode() : 0);
        return hash;
    }

    @Override
    public boolean equals(Object object) {
        // TODO: Warning - this method won't work in the case the id fields are not set
        if (!(object instanceof PersonnelManagement)) {
            return false;
        }
        PersonnelManagement other = (PersonnelManagement) object;
        if ((this.id == null && other.id != null) || (this.id != null && !this.id.equals(other.id))) {
            return false;
        }
        return true;
    }

    @Override
    public String toString() {
        return "com.entities.PersonnelManagement[ id=" + id + " ]";
    }
    
}
